package com.sxkj.web.runnable;

import org.redisson.RedissonRedLock;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class DaemonThread extends Thread {

    private int i =0;

    public DaemonThread() {
    }

    public DaemonThread(RedissonRunnable redissonRunnable) {
    }

    public void run(){
        try {
            while(true){
                i++;
                System.out.println("i="+i);
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            System.out.println("test");
            e.printStackTrace();
        }
    }
    public static void main(String[] args) throws InterruptedException {
        DaemonThread thread = new DaemonThread();
        thread.setDaemon(true);
        thread.start();
        Thread.sleep(2000);
        System.out.println("我离开thread对象也不再打印了，也就是停止了！");
    }
}
